<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        button {
            margin-bottom: 40px;
        }

        li {
            margin-bottom: 5px;
            list-style: none;
            border: 1px solid pink;
            width: 180px;
            text-align: center;
            color: #222;
            height: 22px;
            box-shadow: 1px 3px 1px rgba(0, 0, 0, .5);
        }

        div {
            display: flex;
            justify-content: center;
        }

        ul {
            text-align: center;
        }

        span {
            margin-right: 2px;
        }
    </style>
</head>

<body>
    <div>
        <span>
            <label for="a">省份</label>
            <input type="text" class="shen" value="安徽省">
        </span>
        <span>
            <label for="a">城市</label>
            <input type="text" class="chen" value="合肥市">

        </span>
        <span>
            <button>查询</button><br>

        </span>
    </div>

    <div class="z">

        <ul>
            <h5>地区列表</h5>

            <li class="di"></li>
        </ul>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
    <script>
        document.querySelector('button').addEventListener('click', () => {
            let pshen = document.querySelector('.shen').value
            let pchen = document.querySelector('.chen').value
            axios({
                url: 'http://hmajax.itheima.net/api/area',
                params: {
                    pname: pshen,
                    cname: pchen
                }
            }).then(result => {
                // console.log(result);
                let list = result.data.list
                // console.log(list);
                let see = list.map(marename => ` <li class="di">${marename}</li> `).join('')
                document.querySelector('ul').innerHTML = see
            })
        })
    </script>

</body>

</html>